<?php
class Core_Data_Subcategorylist implements Core_Controller_Mainable, Core_Data_Preparable{
    
    public $database;
    public $database_query;
    
    public function __construct() {
        $this->database = new Core_Driver_MysqlImproved;
    }
    
    public function main(array $variables = null) {
        $this->database->connect();
        $this->prepare_query($variables);
        $this->database->prepare($this->database_query);
        $this->database->query();
        $sub_category_data = array();
        while($sub_category = $this->database->fetch('array')){
            $sub_category_data[$sub_category['sub_category_name']] = $sub_category;
        }
        return $sub_category_data;
    }

    public function prepare_query(array $variables = null) {
        $this->database_query = "SELECT * FROM page_sub_category;";
    }

}
